package cn.chinaunicom.admin.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.chinaunicom.admin.entity.DigitalEnvelope;
import cn.chinaunicom.admin.service.IDigitalEnvelopService;
import cn.chinaunicom.fast.common.utils.Result;

/**
 * 数字信封控制类
 *
 * @ProjectName: esay-secret-server
 * @Package: cn.chinaunicom.admin.controller
 * @ClassName: DigitalEnvelopController
 * @Description: 数字信封控制类
 * @Author: wangjc
 * @CreateDate: 2023/11/22
 * @UpdateUser: wangjc
 * @UpdateDate: 2023/11/22
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
@RestController
@RequestMapping("envelop")
public class DigitalEnvelopController {

    @Autowired
    private IDigitalEnvelopService deService;

    /**
     * 新增
     * @param de
     * @return
     */
    @PostMapping("add")
    public Result<DigitalEnvelope> add(@RequestBody DigitalEnvelope de){
        return Result.success(deService.add(de));
    }

    /**
     * 删除
     * @param deId
     * @return
     */
    @GetMapping("del")
    public Result del(String deId){
        deService.del(deId);
        return Result.success();
    }

    /**
     * 修改
     * @param de
     * @return
     */
    @PostMapping("upd")
    public Result<DigitalEnvelope> upd(@RequestBody DigitalEnvelope de){
        return Result.success(deService.upd(de));
    }

    /**
     * 查询全部
     * @return
     */
    @GetMapping("listAll")
    public Result<List<DigitalEnvelope>> listAll(){
        return Result.success(deService.listAll());
    }
}
